package com.yuanchu.store.client;

import com.yuanchu.store.entity.YoshopGoodsEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @version: 1.0
 * @Author: adan
 * @description:
 * @date: 2024-01-24 11:55
 */
@FeignClient(value = "yuanchu-goods", fallbackFactory = FeignGoodsServiceClientFallbackFactory.class)
public interface FeignGoodsClient {

    @GetMapping("/goods/store/{categoryId}")
    List<YoshopGoodsEntity> queryGoodsByCategoryId(@PathVariable("categoryId") Integer categoryId);

    /**
     * 查询商品购物车
     * @param goodsId
     * @param goodsSkuId
     * @return
     */
    @GetMapping("/goods/cart")
    YoshopGoodsEntity queryGoodsInfo(@RequestParam("goodsId") Integer goodsId, @RequestParam("goodsSkuId") String goodsSkuId);
    /**
     * 商品总数
     * @return
     */
    @GetMapping("/goods/total")
    long queryTotalGoods();

    /**
     * 已售罄商品
     * @return
     */
    @GetMapping("/goods/soldout")
    long querySoldOutGoodsTotal();

    /**
     * 商品销量
     * @return
     */
    @GetMapping("/sale/list")
    List<Map<String, Object>> querySaleGoodsList();

    @GetMapping("/goods/goods/name")
    String queryGoodsName(int goodsId);
}
